package com.user.controllet;

import com.user.pojo.User;
import com.user.pojo.data;
import com.user.reuslt.Result;
import com.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("User")
@CrossOrigin
public class UserController
{
    @Autowired
    private UserService userService;

    @GetMapping("DataUser")
    public Result DataUser()
    {
        Result result = userService.DataUserService();
        return result;
    }

    @GetMapping("DataPosition")
    public Result DataPosition()
    {

        Result result = userService.DataPositionService();
        return result;
    }

    @GetMapping("Data")
    public Result Data()
    {
        Result result = userService.Data();
        return result;
    }

    @PostMapping("query")
    public Result query(@RequestBody data data)
    {
        Result result = userService.QueryService(data);
        return result;
    }

    @PostMapping("insertuser")
    public Result insertuser(@RequestBody User user)
    {
        Result result = userService.InsertUserService(user);
        return result;
    }

    @PostMapping("update")
    public Result update(@RequestBody data data)
    {
        Result result = userService.UpdateService(data);
        return result;
    }

    @PostMapping("delete")
    public Result delete(@RequestBody data data)
    {
        Result result = userService.DeleteService(data);
        return result;
    }
    @PostMapping("batchUp")
    public Result batchUpData(@RequestBody List<data> data){

        Result result = userService.batchUpData(data);
        return result;
    }



}
